// RibbonTab.java
package exercise.jslide.jslide.view.ribbon;

import javafx.scene.control.Tab;
import javafx.scene.layout.HBox;
import java.util.ArrayList;
import java.util.List;
import javafx.collections.ObservableList;
import javafx.scene.Node;

public class RibbonTab extends Tab {
    private HBox content;
    private List<RibbonGroup> groups;

    public RibbonTab(String text) {
        super(text);
        content = new HBox(5); // 设置组之间的间距为5
        content.setStyle("-fx-padding: 5;"); // 设置内边距
        groups = new ArrayList<>();
        setContent(content);
    }

    public ObservableList<Node> getGroups() {
        return content.getChildren();
    }

    public void addGroup(RibbonGroup group) {
        groups.add(group);
        content.getChildren().add(group);
    }

    // 添加多个组的方法
    public void addGroups(RibbonGroup... groups) {
        for (RibbonGroup group : groups) {
            addGroup(group);
        }
    }
}